package com.canis.stockmanager.web;

import com.canis.stockmanager.comm.aop.LoggerManage;
import com.canis.stockmanager.domai.SysUser;
import com.canis.stockmanager.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
@RequestMapping("/")
public class IndexController extends BaseController{
    @Autowired
    private UserRepository userRepository;
    @RequestMapping(value="/login",method= RequestMethod.GET)
    public String login() {
        return "login";

    }
    @RequestMapping(value="/",method=RequestMethod.GET)
    public String index(Model model) {

        return "index";
    }
    @RequestMapping(value="/header",method=RequestMethod.GET)
    @LoggerManage(description="header")
    public String header(Model model) {
        SysUser  user = super.getUser();
        if(null != user){
            model.addAttribute("user",user);
        }
        return "header";
    }
    @RequestMapping(value="/footer",method=RequestMethod.GET)
    @LoggerManage(description="footer")
    public String footer(Model model) {

        return "footer";
    }
    @RequestMapping(value="/centent",method=RequestMethod.GET)
    @LoggerManage(description="centent")
    public String centent(Model model) {

        return "centent";
    }
    @RequestMapping(value="/left",method=RequestMethod.GET)
    @LoggerManage(description="left")
    public String left(Model model) {

        return "left";
    }
}
